package com.xiao.exampleconsumer1;

import com.xiao.example.common.model.User;
import com.xiao.example.common.service.UserService;
import com.xiao.rpc.bootstrap.ConsumerBootstrap;
import com.xiao.rpc.proxy.ServiceProxyFactory;

public class ConsumerExample {
    public static void main(String[] args) {

        //服务器提供者初始化
        ConsumerBootstrap.init();
        // mock测试
//        UserService service = ServiceProxyFactory.getMockProxy(UserService.class);
        UserService service = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("xiaoyu");
        // 【调用】
        User newUser = service.getUser(user);
        if(newUser != null){
            System.out.println(newUser.getName());
        }else {
            System.out.println("user == null");
        }

        // mock测试
//        long number = service.getNumber();
//        System.out.println(number);
    }
}
